package com.qinggeng.project.system.service.impl;

import com.qinggeng.common.utils.DateUtils;
import com.qinggeng.project.system.domain.OrderStatistics;
import com.qinggeng.project.system.mapper.OrderStatisticsMapper;
import com.qinggeng.project.system.service.IOrderStatisticsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 订单数据统计Service业务层处理
 *
 * @author qinggeng
 * @date 2020-06-30
 */
@Service
public class OrderStatisticsServiceImpl implements IOrderStatisticsService
{
    @Resource
    private OrderStatisticsMapper orderStatisticsMapper;

    /**
     * 查询订单数据统计
     *
     * @param id 订单数据统计ID
     * @return 订单数据统计
     */
    @Override
    public OrderStatistics selectOrderStatisticsById(Long id)
    {
        return orderStatisticsMapper.selectOrderStatisticsById(id);
    }

    /**
     * 查询订单数据统计列表
     *
     * @param orderStatistics 订单数据统计
     * @return 订单数据统计
     */
    @Override
    public List<OrderStatistics> selectOrderStatisticsList(OrderStatistics orderStatistics)
    {
        return orderStatisticsMapper.selectOrderStatisticsList(orderStatistics);
    }

    /**
     * 新增订单数据统计
     *
     * @param orderStatistics 订单数据统计
     * @return 结果
     */
    @Override
    public int insertOrderStatistics(OrderStatistics orderStatistics)
    {
        orderStatistics.setCreateTime(DateUtils.getNowDate());
        return orderStatisticsMapper.insertOrderStatistics(orderStatistics);
    }

    /**
     * 修改订单数据统计
     *
     * @param orderStatistics 订单数据统计
     * @return 结果
     */
    @Override
    public int updateOrderStatistics(OrderStatistics orderStatistics)
    {
        return orderStatisticsMapper.updateOrderStatistics(orderStatistics);
    }

    /**
     * 批量删除订单数据统计
     *
     * @param ids 需要删除的订单数据统计ID
     * @return 结果
     */
    @Override
    public int deleteOrderStatisticsByIds(Long[] ids)
    {
        return orderStatisticsMapper.deleteOrderStatisticsByIds(ids);
    }

    /**
     * 删除订单数据统计信息
     *
     * @param id 订单数据统计ID
     * @return 结果
     */
    @Override
    public int deleteOrderStatisticsById(Long id)
    {
        return orderStatisticsMapper.deleteOrderStatisticsById(id);
    }

    @Override
    public int batchInsertData(List<OrderStatistics> orderStatisticsList) {
        return orderStatisticsMapper.batchInsertData(orderStatisticsList);
    }

    @Override
    public List<OrderStatistics> selectPointOrderStatisticsList(Long startTime, Long endTime) {
        return orderStatisticsMapper.selectPointOrderStatisticsList(startTime,endTime);
    }

    @Override
    public OrderStatistics selectPointOrderStatisticsByPointId(Long pointId, Long startTime, Long endTime) {
        return orderStatisticsMapper.selectPointOrderStatisticsByPointId(pointId,startTime,endTime);
    }

    @Override
    public List<Long> listOrdersByPointId(Long pointId, Long startTime, Long endTime) {
        return orderStatisticsMapper.listOrdersByPointId(pointId,startTime,endTime);
    }


}
